package com.ditian.ret;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.ditian.code.ErrorMessage;
/**
 * 通用返回值
 * @author chenweiyi
 *
 */
public abstract class Common {
	/**
	 * 用于区分每一次请求的唯一的字符串。此字符串可以用于后续数据反查。
	 */
	@JSONField(name="request_id")
	private String requestId;
	
	/**
	 * 整个请求所花费的时间，单位为毫秒。
	 */
	@JSONField(name="time_used")
	private int timeUsed;
	
	/**
	 * 当请求失败时才会返回此字符串。
	 */
	@JSONField(name="error_message",serialzeFeatures={SerializerFeature.WriteNullStringAsEmpty})
	private String errorMessage;

	private ErrorMessage error;

	public String getRequestId() {
		return requestId;
	}


	public void setRequestId(String requestId) {
		this.requestId = requestId;
	}


	public int getTimeUsed() {
		return timeUsed;
	}


	public void setTimeUsed(int timeUsed) {
		this.timeUsed = timeUsed;
	}


	public String getErrorMessage() {
		return errorMessage;
	}


	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}


	public ErrorMessage getError() {
		return error;
	}


	public void setError(ErrorMessage error) {
		this.error = error;
	}


	@Override
	public String toString() {
		return "Common [requestId=" + requestId + ", timeUsed=" + timeUsed
				+ ", errorMessage=" + errorMessage + ", error=" + error + "]";
	}
	
	

}
